#include "dul_list.h"
#include "../test.h"

void test()
{
	void *ep;
	dul_list mylist;
	struct mydata elem = {4,'d'},ee = {14,'e'}, e0,
			e1 = {1,'a'},e2 = {2,'b'},
			e3 = {3,'c'}, e4 = {4,'d'};

	dullist_init(&mylist);

	dullist_insert(mylist, 1, (void *) &e1, sizeof(struct mydata));
	dullist_insert(mylist, 2, (void *) &e2, sizeof(struct mydata));
	dullist_insert(mylist, 3, (void *) &e3, sizeof(struct mydata));
	dullist_insert(mylist, 4, (void *) &e4, sizeof(struct mydata));
	dullist_traverseback(mylist, visit);
	
	dullist_delete(mylist,2,(void *) &e0, sizeof(struct mydata));
	visit((void *)&e0);

	dullist_clear(mylist);
	//dullist_destroy(&mylist);
	dullist_traverse(mylist, visit);
	printf("%d\n",dullist_empty(mylist));
	printf("%d\n",dullist_length(mylist));

	//visit(dullist_getelem(mylist, 0));//it just exit

	printf("%d,,,...,.\n",dullist_locateelem(mylist,(void *)&elem, my_compare,sizeof(struct mydata)));
}

int main(){

	test();
}

